import request from '../util/request.js'
import  config from '../util/config.js'
let goodsRequest = {
    baseUrl: config.baseUrl + "/goods",
    /**
     * 给商品设置规格和规格项的关联关系
     * @param obj
     * @param callBack
     */
    saveItemAndSpeRelation(obj,callBack){
        request.post(this.baseUrl+"/item/addItemAndSpeRelation",obj,callBack)
    },
    /**
     * 根据商品id查询商品对应的规格id
     * @param itemId
     * @param callBack
     */
    getSpeIdByItemId(itemId,callBack){
        request.get(this.baseUrl + "/item/querySpeIdByItemId", {itemId: itemId}, callBack);
    },
    /**
     * 分页查询商品列表
     * @param item
     * @param callBack
     */
    listItem(item,callBack){
        request.get(this.baseUrl + "/item/list", item, callBack);
    },
    /**
     * 查询所有的商品分类
     * @param callBack
     */
    getItemCategory(callBack) {
        request.get(this.baseUrl + "/itemCategory/list", null, callBack);
    },
    /**
     * 保存商品的API
     * @param item
     * @param callBack
     */
    saveItem(item,callBack){
        request.post(this.baseUrl+"/item/save",item,callBack)
    }
}
export default goodsRequest;